namespace MySQL {
    const mysql = require('mysql2');
    const config = require('../../settings');
    //创建池子
    const pool = mysql.createPool(config.mysql);
    const promisePool = pool.promise();

    process.on('exit', async (code) => {
        try {
            await pool.end()
        } catch (error) { }
    })

    module.exports = promisePool;
}